package cn.ywang.concurrent;

import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * 读写锁测试
 *
 * @author BeatificWang
 * @date 2019/7/24 22:10
 */
public class ReadWriteLockTest {

	public static void main(String[] args) {
		ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
		ReentrantReadWriteLock.ReadLock readLock = readWriteLock.readLock();
		readLock.lock();

		ReentrantReadWriteLock.WriteLock writeLock = readWriteLock.writeLock();
		writeLock.lock();

		ReentrantLock reentrantLock = new ReentrantLock();
		reentrantLock.lock();
	}
}
